﻿using System;

namespace UniRx.Operators
{
	// Token: 0x02000276 RID: 630
	internal class CombineLatestObserver<T> : IObserver<T>
	{
		// Token: 0x06000E38 RID: 3640 RVA: 0x000430C8 File Offset: 0x000414C8
		public CombineLatestObserver(object gate, ICombineLatestObservable parent, int index)
		{
			this.gate = gate;
			this.parent = parent;
			this.index = index;
		}

		// Token: 0x17000108 RID: 264
		// (get) Token: 0x06000E39 RID: 3641 RVA: 0x000430E5 File Offset: 0x000414E5
		public T Value
		{
			get
			{
				return this.value;
			}
		}

		// Token: 0x06000E3A RID: 3642 RVA: 0x000430F0 File Offset: 0x000414F0
		public void OnNext(T value)
		{
			object obj = this.gate;
			lock (obj)
			{
				this.value = value;
				this.parent.Publish(this.index);
			}
		}

		// Token: 0x06000E3B RID: 3643 RVA: 0x00043140 File Offset: 0x00041540
		public void OnError(Exception error)
		{
			object obj = this.gate;
			lock (obj)
			{
				this.parent.Fail(error);
			}
		}

		// Token: 0x06000E3C RID: 3644 RVA: 0x00043184 File Offset: 0x00041584
		public void OnCompleted()
		{
			object obj = this.gate;
			lock (obj)
			{
				this.parent.Done(this.index);
			}
		}

		// Token: 0x04000838 RID: 2104
		private readonly object gate;

		// Token: 0x04000839 RID: 2105
		private readonly ICombineLatestObservable parent;

		// Token: 0x0400083A RID: 2106
		private readonly int index;

		// Token: 0x0400083B RID: 2107
		private T value;
	}
}
